import Swiper,{ loadSwiper } from "../components/Swiper"
import React from "react"
import Movie, { loadMovie } from "../components/Movie"
import Layout from "../components/Layout"

export default function Home({swiper,movie}) {
  return <Layout>
    <Swiper data={swiper}></Swiper>
    <Movie data={ movie } title='电影'></Movie>
  </Layout>
}

export async function getStaticProps () {
  // 获取轮播图数据
  let { data: swiper } = await loadSwiper()
  // 获取电影列表
  let { data: movie } = await loadMovie()
  return {
    props: {
      swiper,
      movie
    }
  }
}
